#ifndef __TOUCH_H__
#define __TOUCH_H__

#include <nxos.h>
#include <base/clock.h>

#define GT911_ADDR_LEN 2
#define GT911_REGITER_LEN 2
#define GT911_MAX_TOUCH 5
#define GT911_POINT_INFO_NUM 5

#define GT911_ADDRESS_HIGH 0x5D
#define GT911_ADDRESS_LOW 0x14

#define GT911_COMMAND_REG 0x8040
#define GT911_CONFIG_REG 0x8047

#define GT911_PRODUCT_ID 0x8140
#define GT911_VENDOR_ID 0x814A
#define GT911_READ_STATUS 0x814E

#define GT911_POINT1_REG 0x814F
#define GT911_POINT2_REG 0x8157
#define GT911_POINT3_REG 0x815F
#define GT911_POINT4_REG 0x8167
#define GT911_POINT5_REG 0x816F

#define GT911_CHECK_SUM 0x80FF

struct touch_data
{
    NX_U8 event;            /* The touch event of the data */
    NX_U8 track_id;         /* Track id of point */
    NX_U8 width;            /* Point of width */
    NX_U16 x_coordinate;    /* Point of x coordinate */
    NX_U16 y_coordinate;    /* Point of y coordinate */
    NX_ClockTick timestamp; /* The timestamp when the data was received */
};

/* Touch event */
#define  TOUCH_EVENT_NONE              (0)   /* Touch none */
#define  TOUCH_EVENT_UP                (1)   /* Touch up event */
#define  TOUCH_EVENT_DOWN              (2)   /* Touch down event */
#define  TOUCH_EVENT_MOVE              (3)   /* Touch move event */


void NX_TouchDriverInit(void);

#endif
